package EveryDay;

import java.util.Stack;

public class P925 {
    public static void main(String[] args) {
        aaa solution=new aaa();
        System.out.println(solution.isLongPressedName("alex", "aaleexeex"));;
    }
}

class aaa {
    public boolean isLongPressedName(String name, String typed) {
        int i=0,j=0;
        while(j<typed.length()){
            if(i<name.length()&&name.charAt(i)==typed.charAt(j)){
                i++;
                j++;
            }
            else if(j>0&&name.charAt(j)==typed.charAt(j-1)){
                j++;
            }
            else{
                return false;
            }
        }
        return i==name.length();



    }
}
